<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>订单管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-
scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../css/y_index.css" />
    <link rel="stylesheet" type="text/css" href="../js/drop/dropload.css" />
    <style>

    </style>
</head>

<body>
    <div class="pos_r">
        <ul class="bw flex_a flex_sa bw ptb20 top">
            <li class="colc active">全部</li>
            <li class="colc" data-id='1'>待发货</li>
            <li class="colc" data-id='2'>待收货</li>
            <li class="colc" data-id='3'>已完成</li>
        </ul>
        <div class="container">
            <div class="mainBox">
                <!-- <div class="bw mt20 list">
                <li class="flex_sb p20 bdb">
                    <span class="col9">订单编号：2132563</span>
                    <span class="c4">待发货</span>
                </li>
                <li class="p20 flex_sb aie">
                    <div class="flex_a">
                        <img src="../img/y_8.png" style="width: 1.5rem;height: 1.5rem;" />
                        <em class="flex flex_column ml20">
                        <span class="font15">清风纸巾</span>
                        <span class="col9 mt20">分类：日用品</span>
                        <span class="c4 mt20">￥2.00</span>
                        </em>
                    </div>
                    <span class="col9">x1</span>
                </li>
                <li class="p20 bdt">共1件商品 合计：<span class="c4">￥10.00</span></li>
            </div> -->
                <!-- <div class="bw mt20 list">
                <li class="flex_sb p20 bdb">
                    <span class="col9">订单编号：2132563</span>
                    <span class="c5">待收货</span>
                </li>
                <li class="p20 flex_sb aie">
                    <div class="flex_a">
                        <img src="../img/y_8.png" style="width: 1.5rem;height: 1.5rem;" />
                        <em class="flex flex_column ml20">
                        <span class="font15">清风纸巾</span>
                        <span class="col9 mt20">分类：日用品</span>
                        <span class="c4 mt20">￥2.00</span>
                        </em>
                    </div>
                    <span class="col9">x1</span>
                </li>
                <li class="p20 bdt">共1件商品 合计：<span class="c4">￥10.00</span></li>
            </div> -->
            </div>
        </div>
    </div>
</body>

</html>
<script src="../js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/dlc.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/drop/dropload.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.0/alipayjsapi.inc.min.js"></script>
<!--公司的常用函数封装-->
<script type="text/javascript">
var page = 0,
    limit = 10,
    hui = '',
    id = "",
    off = 0;
$('.top').on('click', 'li', function() { //菜单点击事件
    if (off) return false;
    off = 1;
    $(this).addClass('active').siblings().removeClass('active');
    id = $(this).data('id');
    page = 1;
    getList(id);
})
// getList(0);

//内容列表
$('.container').dropload({
    scrollArea: window,
    domUp: {
        domClass: 'dropload-up',
        domRefresh: '<div class="dropload-refresh">↓下拉刷新</div>',
        domUpdate: '<div class="dropload-update">↑释放更新</div>',
        domLoad: '<div class="dropload-load"><span class="loadings"></span>加载中...</div>'
    },
    domDown: {
        domClass: 'dropload-down',
        domRefresh: '<div class="dropload-refresh">↑上拉加载更多</div>',
        domLoad: '<div class="dropload-load"><span class="loadings"></span>加载中...</div>',
        domNoData: '<div class="dropload-noData">暂无更多数据</div>'
    },
    loadUpFn: function(me) {
        hui = me;
        page = 1;
        getList(id);
    },
    loadDownFn: function(me) {
        hui = me;
        page++;
        getList(id);
    },
    threshold: 50
});

function getList(id) {
    console.log(id)
    var data = { page: page, limit: limit };
    if (id) {
        data.status = id
    }
    dlc_request('/api/onlineOrder/OnlineOrderlist', data, function(res) {
        console.log(res);
        off = 0;
        if (res.code == 1) {
            var str = '';
            var list = res.data.list;
            if (list.length > 0) {
                console.log(id);
                for(i in list){
                	str+='<div class="bw mt20 list" data-order="'+list[i].orderNo+'" data-status="'+list[i].status+'">'+
			                '<li class="flex_sb p20 bdb">'+
			                    '<span class="col9">订单编号：'+list[i].orderNo+'</span>'+
			                    '<span class="' + (list[i].status == 0 ? 'col9' : list[i].status == 1 ? 'c4' : list[i].status == 2 ? 'c5' : 'col9') + '">' + (list[i].status == 0 ? '待付款' : list[i].status == 1 ? '待发货' : list[i].status == 2 ? '待收货' : '已完成') + '</span>'+
			                '</li>';
			                
                	for(j in list[i].goodsMap){
                		str+='<li class="p20 flex_sb aie">'+
			                    '<div class="flex_a">'+
			                        '<img src="'+list[i].goodsMap[j].imgUrl+'" style="width: 1.5rem;height: 1.5rem;" />'+
			                        '<em class="flex flex_column ml20">'+
			                        '<span class="font15">'+list[i].goodsMap[j].goodsName+'</span>'+
			                        '<span class="col9 mt20">分类：'+list[i].goodsMap[j].cateName+'</span>'+
			                        '<span class="c4 mt20">￥'+list[i].goodsMap[j].goodsPrice+'.00</span>'+
			                        '</em>'+
			                    '</div>'+
			                    '<span class="col9">x'+list[i].goodsMap[j].goodsNum+'</span>'+
			                '</li>';
                	}
					str+='<li class="p20 bdt"><p>运费：'+list[i].goodsMap.length+'元</p>共'+list[i].orderNum+'件商品 合计：<span class="c4">￥'+list[i].realPayment+'</span></li></div>';
                }
                
            } else {
                // 锁定
                hui.lock();
                // 无数据
                hui.noData();
            }
            setTimeout(function() {
                if (page == 1) {
                    $('.mainBox').html(str);
                } else {
                    $('.mainBox').append(str);
                }
                hui.resetload();
                hui.unlock();
                hui.noData(false);
            }, 1500);
        } else {
            dlctipbox.show(res.msg);
        }
    })
}
// 进入详情
$('.mainBox').on('click', '.list', function() {
    location.href = './ser_shopDetail.html?order=' + $(this).data('order') + '&status=' + $(this).data('status');
})
</script>